//  -------------------- iSharePoint -------------------- //
// 
//  Company:	IT Complex, LLC
//  Project:	Smart.Common
//  File name:	IQueryBuilderItem.cs
//  Developer:	Solomatov Igor
//  Created:	15.04.2012
// 
//  -------------------- iSharePoint -------------------- //

namespace Smart.Common.Entities
{
	/// <summary>
	/// Query Item
	/// </summary>
	public interface IQueryBuilderItem<TExecutorType>
		where TExecutorType : class
	{
		/// <summary>
		/// Query Builder
		/// </summary>
		IQueryBuilder<TExecutorType> Query { get; set; }

		/// <summary>
		/// Return to QueryBuilder Where
		/// </summary>
		IQueryBuilderWhere<TExecutorType> Where { get; }

		/// <summary>
		/// Return to QueryBuilder OrderBy
		/// </summary>
		IQueryBuilderOrderBy<TExecutorType> OrderBy { get; }

		/// <summary>
		/// Return to QueryBuilder GroupBy
		/// </summary>
		IQueryBuilderGroupBy<TExecutorType> GroupBy { get; }

		/// <summary>
		/// Query executor
		/// </summary>
		TExecutorType Executor { get; }

		/// <summary>
		/// Return casted query executor
		/// </summary>
		TMyExecutorType GetExecutor<TMyExecutorType>()
			where TMyExecutorType : TExecutorType;

		/// <summary>
		/// Operator
		/// </summary>
		string Op { get; set; }

		/// <summary>
		/// Format CAML statement
		/// </summary>
		string FormatQuery();

		/// <summary>
		/// Return Cache code (hash of cache-dependent parameters)
		/// </summary>
		int GetCacheCode();
	}
}